<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title><!--排版查询--></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-box.css">
<link rel="stylesheet" href="css/project/style.css">
<link rel="stylesheet" href="css/zv_common.css">
 <script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_json.js"></script>
<script src="js/main.js"></script>
<script src="js/init.js"></script>
<script src="js/zv_loadp.js"></script>
<script type="text/javascript" src="js/JsonSQL/jsonsql-0.1.js"></script>
<script src="js/talkingdata.js"></script>
<style type="text/css">
.scheresline{border-bottom:#e5e5e5 solid;}
table td{line-height:2em; height:2em; }
	.timecolor{ color:#afafaf}
	table span{ color:#afafaf}
</style>
</head>
<body class="um-vp c-wh2" ontouchstart>
<div id="page_1" class="ub ub-ver um-vp">
<div id="scheduling_list" ></div>
</div>
<div id="rowindex"></div>
<div id="LoadMore"></div>
</body>
<script>
zy_init();
window.uexOnload=function(type){
	//$("body").css("opacity","0");
	if(!type){
		uexWindow.setBounce("0");
		IC.talkingDataCount("排班查询","0007");
	}
	Loading(0);
	scheduling_list(1);
	
}
function LoadMore()
{
	IC.talkingDataCount("排班查询","0007");
	$$("LoadMore").innerHTML = '<div style="height:2.6em;  line-height:2.6em;background:#e8e8e8; text-align:center; font-size:0.9em; color:#4d4d4d; overflow:hidden; display:block; border-top:solid #ffffff 1px">加载中...</div> ';
	var page = localStorage.getItem("scheduling_searchresult_page");
	var nextpage = parseInt(page)+1;
	var zv_current=localStorage.getItem("zv_current");
	if(zv_current=='')
	{
		ueppscript("scheduling_search_calendar","content","LoadDataS2all("+nextpage+")");
	}
	else
	{
		ueppscript("scheduling_search_calendar","content","LoadDataSall("+"'"+zv_current+"'"+","+nextpage+")");
	}
}
function scheduling_list(page){	
			Loading(0);
			 var strx = "";
			 var zv_current = localStorage.getItem("zv_current");//点击某个时间
			 var json = localStorage.getItem("zvData");
			 var search_employeeNumber = localStorage.getItem("search_employeeNumber");//搜索员工ID
			 var jsona ='['+json+']';
			 var  obj = strToJson(jsona);
			 var  TotalCount=obj[0].Result.TotalCount
			 localStorage.setItem("TotalCount",TotalCount);
			 var objdata = obj[0].Result.DataTable;
			 var enl=objdata.length
			if(enl==undefined || enl=="undefined")
			{
				var stringObj=json  
				var zv_newstr=stringObj.replace('"DataTable":{"Rows":{','"DataTable":[{'); //字符替换 
				zv_newstr=zv_newstr.replace('}}}}','}]}}'); //字符替换 
				zv_newstr ='['+zv_newstr+']';
				zv_objdata = strToJson(zv_newstr);
				objdata = zv_objdata[0].Result.DataTable;
			}
			var z=0
			for(var i=0;i<objdata.length;i++)	
			{
				
				var orderx=(parseInt(z)+1)%4;
				if(parseInt(orderx)==0)
				{
				orderx= 4;
				}
				z++
				var dateid= objdata[i].dateId
				if(dateid!="")
				{
					dateid = dateid.substring(0,10);//日期
				}
				
				var organizationName= objdata[i].organizationName
				if(organizationName=="" || organizationName==" " || organizationName=="undefined" ||   organizationName==undefined)//Organization Name
				{
					organizationName = "&nbsp; "
				}
				var roleName= objdata[i].roleName
				if(roleName=="" || roleName==" " || roleName=="undefined" ||   roleName==undefined)//角色
				{
					roleName = "&nbsp; "
				}
				var WorkingHours= objdata[i].WorkingHours
				if(WorkingHours=="" || WorkingHours==" " || WorkingHours=="undefined" ||   WorkingHours==undefined)//工作时间
				{
					WorkingHours = "0 "
				}
				else
				{
				   WorkingHours =  Math.round(WorkingHours*100)/100
				}
				
				var startDateTime= objdata[i].startDateTime
				if(startDateTime=="" || startDateTime==" " || startDateTime=="undefined" ||   startDateTime==undefined)//开始时间
				{
					startDateTime = "无计划 "
				}
				else
				{
				       startDateTime = startDateTime.substring(5,16);
					   startDateTime= startDateTime.replace("T"," ");
				}
				var actualStartTime= objdata[i].actualStartTime
				if(actualStartTime=="" || actualStartTime==" " || actualStartTime=="undefined" ||   actualStartTime==undefined)//实际开始时间
				{
					actualStartTime = "&nbsp; "	
				}
				else
				{
					actualStartTime= actualStartTime.replace("PT","");
					actualStartTime= actualStartTime.replace("M","");
					actualStartTime= actualStartTime.replace("H",":");
				}
				var endDateTime= objdata[i].endDateTime
				if(endDateTime=="" || endDateTime==" " || endDateTime=="undefined" ||  endDateTime==undefined)//结束时间
				{
					endDateTime = "无计划"
				}
				else
				{
				       endDateTime = endDateTime.substring(5,16);
					   endDateTime= endDateTime.replace("T"," ");
				}
				var ActualWorkingHours= objdata[i].ActualWorkingHours
				if(ActualWorkingHours=="" || ActualWorkingHours==" " || ActualWorkingHours=="undefined" ||   ActualWorkingHours==undefined)//实际工作时间
				{
					ActualWorkingHours = "0 "
				}
				else
				{
				   ActualWorkingHours =  Math.round(ActualWorkingHours*100)/100
				}
				
				var actualEndTime= objdata[i].actualEndTime
				if(actualEndTime=="" || actualEndTime==" " || actualEndTime=="undefined" ||   actualEndTime==undefined)//实际结束时间
				{
					actualEndTime = "&nbsp; "
				}
				else
				{
					actualEndTime= actualEndTime.replace("PT","");
					actualEndTime= actualEndTime.replace("M","");
					actualEndTime= actualEndTime.replace("H",":");
				}
				var EmployeeNumber=localStorage.getItem("EmployeeNumber");//员工工号
				var PeriodStart=	localStorage.getItem("PeriodStart");//开始日期
				var PeriodEnd=localStorage.getItem("PeriodEnd");//结束日期
				//var PeriodStart_time=zv_transdate(PeriodStart);//开始日期时间戳
				//var PeriodEnd_time=zv_transdate(PeriodEnd)//结束日期时间戳
				//var difference_time=parseInt(PeriodEnd_time)-parseInt(PeriodStart_time)
				if(PeriodStart!=PeriodEnd&&EmployeeNumber=='')
				{
				strx += '<div class="ub ub-ver  zv_lbg'+orderx+'"  onclick="LoadDataS('+objdata[i].employeeNumber+',1)">'
				}
				else
				{
					strx += '<div class="ub ub-ver  zv_lbg'+orderx+'">'
				}
			    strx += '<div class="ub uinn c-fff ubb ubt b-gra5 umh2 scheresline"  >'
			    strx += '<div class="ulev-1">'+objdata[i].EmployeeName+'('+objdata[i].employeeNumber+')&nbsp;'+organizationName+'&nbsp;'+roleName+'</div>'
			    strx += '</div>'
			    strx += '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size:0.8125em;">'
			    strx += '<tr bgcolor="#e8e8e8">'
			   	strx += '<td width="1%" colspan="2">&nbsp;</td>'
			    strx += '<td colspan="3" bgcolor="#e8e8e8">'+dateid+'</td>'
			    strx += '</tr>'
			    strx += '<tr>'
			    strx += '<td rowspan="3" ></td>'
			    strx += '<td rowspan="3">&nbsp;</td>'
			    strx += '<td width="30%">计划时间</td>'
			    strx += '<td align="center" width="24%">实际时间</td>'
			    strx += '<td width="42%">工作时间：<span>'+WorkingHours+'</span></td>'
			    strx += '</tr>'
			    strx += '<tr>'
			    strx += '<td  ><span>'+startDateTime+'</span></td>'
			    strx += '<td  align="center"><span>'+actualStartTime+'</span></td>'
			    strx += '<td>实际工作时间：<span>'+ActualWorkingHours+'</span></td>'
			    strx += '</tr>'
			    strx += '<tr>'
			    strx += '<td><span>'+endDateTime+'</span></td>'
			    strx += '<td align="center"><span>'+actualEndTime+'</span></td>'
			    strx += '<td>缺席时间：<span>'+objdata[i].AbsentHours+'</span></td>'
			    strx += '</tr>'
			    strx += '</table>'
			   	strx += '</div>'	
			 }
			 Loading(-1);
			 $$("scheduling_list").innerHTML=$$("scheduling_list").innerHTML+strx;
			var s= objdata.length-1
			s=parseInt(objdata[s].rowindex)+1
			var load_more=''
			if(s<TotalCount)
			{
				load_more='<div style="height:2.6em;  line-height:2.6em;background:#e8e8e8; text-align:center; font-size:0.9em; color:#4d4d4d; overflow:hidden; display:block; border-top:solid #ffffff 1px" onclick="LoadMore()">加载更多</div>'
			}
			$$("LoadMore").innerHTML =load_more;
			 localStorage.setItem("search_employeeNumber",'')	
}

function LoadDataS(employeeNumber,page)
{	
	IC.talkingDataCount("排班查询","0007");
	uexEMM.setEvent("1","{'排版查询':'排版查询内页详细'}");
	Loading(0);
	localStorage.setItem("employees_page",page);
	localStorage.setItem("employeeNumber_id",employeeNumber);
	var SiteName=localStorage.getItem("SiteName");//站点名称
	var SiteID=localStorage.getItem("SiteID");//SiteID
	var PeriodStart=	localStorage.getItem("PeriodStart");//开始日期
	var PeriodEnd=localStorage.getItem("PeriodEnd");//结束日期
	var wsdl = scheduling_list_url
    var nameSpace = scheduling_list_nameSpace
	var paras = "CenterName|SiteID|PeriodStart|EmployeeNumber|PeriodEnd|PageCount|CurrentPage";
	var values = SiteName+'|'+SiteID+'|'+PeriodStart+'|'+employeeNumber+'|'+PeriodEnd+'|20|'+page;
	var method = scheduling_list_function
	if(page>=2)
	{
		setLocalJosnPage(wsdl,nameSpace,paras,values,method,"employees","scheduling_list");		
	}
	else
	{
		setLocalJosn(wsdl,nameSpace,paras,values,method,"employees","employees.html");	
	}
}	
</script>
</html>
